<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<script type="text/javascript">
var  html="";
var checkit=true;    
function save(){
	var arr=document.getElementsByName("check");
	for(i=0;i<arr.length;i++){
	  if(arr[i].checked){
		 var v=arr[i].value;
		 var sz=v.split(","); 
		 $.ajax({
	  			type:'post',
	  			url:'${pageContext.request.contextPath }/plupmodule/addPage',
	  		    dataType: "json",
	  		    data:{'moduleid':'${moduleid }', 'pageid':sz[0]},
	  		    async: false,
	  			success:function(data){//返回json结果
	      			
	  			}
	  		});	
		 html=html+'<tr onclick="selectModule(this,2)" align="center" class="row_module">'+
		 '<td><input type="radio" name="check" id="check" value="'+sz[0]+','+sz[1]+','+sz[2]+','+sz[3]+'"></input></td>'+
			'<td>'+sz[0]+'</td>'+
			'<td>'+sz[1]+'</td>';
			if(sz[2]==1){
				html=html+'<td>模板配置生成</td>'; 	
			}else
			{
				html=html+'<td>自定义页面</td>'; 	
			}
			
			html=html+'<td>'+sz[3]+'</td></tr>';
     }
	
 }
	window.returnValue =html;
	window.close();
	
}
function checkAll(){
		   var chkAll =   document.getElementsByName("check");    
		    if   (checkit)     
		    {     
		    for   (var i=0;i<chkAll.length;i++)     
		      chkAll.item(i).checked=true;     
		      checkit   =   false;     
		    }     
		    else     
		    {     
		    for   (i=0;i<chkAll.length;i++)     
		      chkAll.item(i).checked=false;     
		      checkit   =   true;     
		    }     
		}

</script>

</head>
<body >
<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          请输入查询条件
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form" id="modulelistForm" name="modulelistForm" action="${pageContext.request.contextPath }/plupmodule/modulelist" method="post">
                      
                       <div class="form-group">
                          <label class="col-xs-1 control-label" for="ds_username">页面标识</label>
                          <div class="col-xs-3">
                             <input class="input-sm form-control" id="moduleid" name="moduleid" value="${moduleid}" type="text"/>
                          </div>
                          <label class="col-xs-1 control-label" for="ds_password">页面名称</label>
                          <div class="col-xs-3">
 									<input class="input-sm  form-control" id="modulename" name="modulename"  value="${modulename}" type="text"/>
                          </div>
                          <div class="col-xs-3">
                          	 <button  type="submit"  class="btn btn-default btn-sm" >查询</button>                          
                          </div>
                       </div>
            
   </div>
</div>			
<div class="ps-btn-opt">
				<input type="button" class="btn btn-default" value="添加"  onclick="save()" />
				<input type="button" class="btn btn-default" value="全选"  onclick="checkAll()" />
			</div>		
			<table class="table table-bordered" style="" width="100%" cellspacing="1" cellpadding="0" border="0">
				<thead>
					<tr align="center" class="active">
						<td>选择</td>
						<td>页面标识</td>
						<td>页面名称</td>
						<td>页面制作方式</td>
						<td>最近修改时间</td>
					</tr>
				</thead>				
				<tbody>
					<c:forEach items="${modulelist}" var="module" varStatus="s" >
					<tr  align="center" class="row_module">
					<td> <input  type="checkbox" name="check" id="check" value="${module.pageId},${module.pageName},${module.pageMakeMode},${module.lastModifyDate}"/></td>
					<td>${module.pageId}</td>
					<td>${module.pageName}</td>	
					<c:if test=""></c:if>		
					<td>
					<c:if test="${module.pageMakeMode==1}">模板配置生成</c:if>
					<c:if test="${module.pageMakeMode==2}">自定义页面</c:if>			
					</td>
					<td>${module.lastModifyDate}</td>
					</tr>
					</c:forEach>	
				</tbody>
			</table>
			<%@ include file="/page/page.jsp" %>
			
		</form>
</body>

</html>
